package org.dreamwork.base.sh.dao;

import org.dreamwork.base.sh.Parameter;
import org.dreamwork.base.sh.Sort;
import org.dreamwork.util.IDataCollection;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: seth
 * Date: 2009-8-21
 * Time: 14:11:34
 */
public interface IGenericDao<T, PK extends Serializable> {
    PK save (T o);
    void save (T... o);
    void save (Collection<T> o);

    void update (T o);
    void update (T... o);
    void update (Collection<T> o);

    void delete (T o);
    void delete (T... o);
    void delete (Collection<T> o);

    T get (PK id);
    T get (Parameter... parameters);
    T get (Collection<Parameter> parameters);
    T get (Sort sort, Parameter... parameters);
    T get (Sort sort, Collection<Parameter> parameters);

    boolean exists (PK id);
    boolean exists (Parameter... parameters);
    boolean exists (Collection<Parameter> parameters);

    List<T> find (Parameter... parameters);
    List<T> find (Collection<Parameter> parameters);
    IDataCollection<T> find (int pageNo, int pageSize, Sort sort, Parameter... parameters);
    IDataCollection<T> find (int pageNo, int pageSize, Sort sort, Collection<Parameter> parameters);

    int executeUpdate (String hql, Parameter... parameters);
    int executeUpdate (String hql, Collection<Parameter> parameters);
    List executeQuery (String hql, Parameter... parameters);
    List executeQuery (String hql, Collection<Parameter> parameters);
    IDataCollection executeQuery (int pageNo, int pageSize, String hql, Parameter... parameters);
    IDataCollection executeQuery (int pageNo, int pageSize, String hql, Collection<Parameter> parameters);
}